<template>
  <div>
    <headerX title="联系人"></headerX>
    <van-contact-edit
      is-edit
      show-set-default
      :contact-info="editingContact"
      set-default-label="设为默认联系人"
      @save="onSave"
      @delete="onDelete"
    />
  </div>
</template>
<script lang="ts">
import { Toast } from "vant";
import { mapState, mapMutations } from "vuex";
export default {
  data() {
    return {
      editingContact: {},
    };
  },
  methods: {
    ...mapMutations([
      "savecontactInfo",
      "changeAppPhone", // this.changePhone  = store.commit('changePhone')
    ]),
    onSave(contactInfo) {
      this.savecontactInfo(contactInfo)
      // localStorage.addresspeople = contactInfo;
      // localStorage.addressPhone=contactInfo.tel
      this.$router.history.go(-1)
      Toast("保存");
    },
    onDelete(contactInfo) {
      Toast("删除");
    },
  },
};
</script>